s = "abcabcbb"
 var lengthOfLongestSubstring = function(s) {
     let len=s.length
     let max=0
     let left=0
     const set=new Set()
     for(let right=0;right<len;right++)
     {
        
       while(set.has(s[right]))
       {
          set.delete(s[left])
          left++
       }
       set.add(s[right])
       max=Math.max(set.size,max)    
     }
     return max


    
};
console.log(lengthOfLongestSubstring(s));
